package com.pai4j.remote.pgc.community;

import com.pai4j.common.bean.PAIPageResponseBeanUtil;
import com.pai4j.common.bean.PAIResponseBean;
import com.pai4j.domain.community.CTCHomeRecommendQuestionVO;
import com.pai4j.domain.community.CTCHomeRecommendVideoVO;
import com.pai4j.domain.community.vo.request.CCVideoSaveRequestVO;
import com.pai4j.domain.community.vo.response.cc.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * community Video (视频) Feign Client
 * 提供社区视频相关的远程调用接口
 *
 * @author: CYM-pai
 * @date: 2025/10/28
 **/
@FeignClient(name = "pai4j-pgc-service", contextId = "ccVideoClient")
public interface CCVideoClient {

    /**
     * 保存/编辑视频
     */
    @PostMapping("/pgc-service/api/cc/video/save")
    PAIResponseBean<Long> save(@RequestBody CCVideoSaveRequestVO videoSaveRequest);

    /**
     * 删除视频
     */
    @PostMapping("/pgc-service/api/cc/video/delete/{id}")
    PAIResponseBean<Boolean> delete(@PathVariable("id") Long id);

    /**
     * 设置视频推荐
     */
    @PostMapping("/pgc-service/api/cc/video/setRecommend/{id}/{status}")
    PAIResponseBean<Boolean> setRecommend(@PathVariable("id") Long id, 
                                         @PathVariable("status") Boolean status);

    /**
     * 获取视频详情
     */
    @GetMapping("/pgc-service/api/cc/video/detail/{questionId}")
    PAIResponseBean<CTCVideoDetailVO> detail(@PathVariable("questionId") Long questionId);

    /**
     * 获取视频基础信息
     */
    @GetMapping("/pgc-service/api/cc/video/detail/base/{questionId}")
    PAIResponseBean<CTCVideoBaseVO> detailBase(@PathVariable("questionId") Long questionId);

    /**
     * 分页查询视频列表（支持多种列表类型）
     * @param listType 列表类型：new（最新）、hot（热门）、recommend（推荐）
     */
    @GetMapping("/pgc-service/api/cc/video/page/{listType}/{pathId}")
    PAIPageResponseBeanUtil<List<CTCVideoListVO>> pageNewList(
            @PathVariable("listType") String listType,
            @PathVariable("pathId") Long pathId,
            @RequestParam(value = "pageNo", defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize);

    /**
     * 管理后台分页查询视频列表
     */
    @GetMapping("/pgc-service/api/cc/video/adminPageList")
    PAIPageResponseBeanUtil<CTCVideoListVO> adminPageList(
            @RequestParam(value = "pathId", required = false) Long pathId,
            @RequestParam(value = "kw", required = false) String kw,
            @RequestParam(value = "status", required = false) Integer status,
            @RequestParam(value = "top", required = false) Boolean top,
            @RequestParam(value = "recommend", required = false) Boolean recommend,
            @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
            @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize);

    /**
     * 获取推荐视频列表
     */
    @GetMapping("/pgc-service/api/cc/video/recommendList/{pathId}/{size}")
    PAIResponseBean<List<CTCHomeRecommendVideoVO>> recommendList(@PathVariable("pathId") Long pathId,
                                                                 @PathVariable("size") Integer size);

    /**
     * 获取视频列表
     */
    @GetMapping("/pgc-service/api/cc/video/list/{pathId}")
    PAIResponseBean<List<CTCHomeRecommendVideoVO>> videoList(@PathVariable("pathId") Long pathId);

    /**
     * 获取推荐问题列表
     */
    @GetMapping("/pgc-service/api/cc/video/recommend/{pathId}")
    PAIResponseBean<List<CTCHomeRecommendQuestionVO>> recommend(@PathVariable("pathId") Long pathId);

    /**
     * 更新视频为免费/付费
     */
    @PostMapping("/pgc-service/api/cc/video/updateFree/{id}")
    PAIResponseBean<Boolean> updateFree(@PathVariable("id") Long id);
}

